/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pushy.client;

import java.awt.Dimension;

/**
 *
 * @author philipp
 */
public class MainMenu extends javax.swing.JPanel {

    Client client;
    
    /**
     * Creates new form MainMenu
     */
    public MainMenu(Client client) {
        initComponents();
        setVisible(true);
        setSize(995, 550);
        
        this.client = client;
        //jLabel1.setVisible(false);
        
        client.getGUI().setTitle("Pushynator");
    }
   
    @Override
    public Dimension getPreferredSize() {
        return new Dimension(995, 550);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        challenge = new javax.swing.JButton();
        toplist = new javax.swing.JButton();
        logout = new javax.swing.JButton();
        connect = new javax.swing.JButton();

        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Grafiken/Startbildschirm2.png"))); // NOI18N
        add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(-20, 0, 1000, 520));

        challenge.setText("Spielen");
        challenge.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                challengeActionPerformed(evt);
            }
        });
        add(challenge, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 170, 164, 51));

        toplist.setText("Rangliste");
        toplist.setEnabled(false);
        add(toplist, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 260, 164, 50));

        logout.setText("Abmelden");
        logout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutActionPerformed(evt);
            }
        });
        add(logout, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 470, 190, 40));

        connect.setText("Verbinden");
        connect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                connectActionPerformed(evt);
            }
        });
        add(connect, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 415, 190, 40));
    }// </editor-fold>//GEN-END:initComponents

    private void logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutActionPerformed
        client.logout();
        client.getGUI().setVisible(false);
        System.exit(0);
    }//GEN-LAST:event_logoutActionPerformed

    private void connectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectActionPerformed
        client.logout();
        client.getGUI().Anmeldebildschirm();
    }//GEN-LAST:event_connectActionPerformed

    private void challengeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_challengeActionPerformed
        client.getGUI().Challenge();
    }//GEN-LAST:event_challengeActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton challenge;
    private javax.swing.JButton connect;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton logout;
    private javax.swing.JButton toplist;
    // End of variables declaration//GEN-END:variables
}
